﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mojo;
using System.IO;


namespace Mojo.MovieFinder
{
    public class MojoTemplate : Template
    {
        [FactoryMethod(InstanceMode.PerContext)]
        public virtual MovieLister MyMovieLister()
        {
            var lister = CreateObject<MovieLister>();
            lister.MovieFinder = AnotherMovieFinder();
            return lister;
        }

        [FactoryMethod(InstanceMode.PerContext)]
        public virtual IMovieFinder MyMovieFinder()
        {
            var finder = CreateObject<SimpleMovieFinder>();
            return finder;
        }

        [FactoryMethod(InstanceMode.PerContext)]
        public virtual IMovieFinder AnotherMovieFinder()
        {
            FileInfo fileInfo = new FileInfo(@"..\..\movies.txt");
            var finder = CreateObject<ColonDelimitedMovieFinder>(fileInfo);
            return finder;
        }
    }
}
